﻿<?php
    @session_start();
    include("template/head_ajax.php");
     //include("submit/Articles/test_qte.php");
?>
<script type="text/javascript">
///////////STATS ///////////////////
  var loader = "assets/img/loader.gif";
  //alert('test');
  jQuery(document).ready(function($){

      $('#show').click(function(){
         //alert('test');
        // Recuperation des inputs
        var id_type = $('#id_type').val();
        var id_lieu = $('#id_lieu').val();
        var article = $('#ref_article').val();  
        
        // On va donc signaler que nous sommes en train de faire quelque chose à l'aide d'une petite image
        $('#statistique_mov').html('').html('<center><img src="' + loader + '" alt="#" />&nbsp;Chargement...</center>');
        // Maintenant nous pouvons commencer l'envoi des donnees
        $.ajax({
          url: 'ajax/statistiques_sur_articles.php',
          type: 'POST',
          data: {
            id_article:article,
            id_type : id_type,
            id_lieu : id_lieu
            
          },
          error: function(jqXHR, textStatus, errorThrown) {
            // En cas d'erreur, on le signale
            $('#resultSearch').html('').html('<div class="error">Une erreur est survenue lors de la requête.</div>');
          },
          success: function(data, textStatus, jqXHR) {
            // Succes. notif ou affichage
            $('#statistique_mov').html('').html(data);  
            
          }
        });  
  });
  

});
////////////////////////////////////////////////
</script>
    <div class="container-fluid">
        <div class="row-fluid">
                
        <?php include("template/menu_left.php") ?>                
        <div class="span10" id="content">
            <div class="row-fluid">
				
            <!-- block -->
                <!--  ************************ ROW ************************  -->
              <div class="span12">   
                 <div class="block">
                    <div class="navbar navbar-inner block-header">
                        <div class="muted pull-left">Mouvement des articles</div>
                        <!-- .toolbar -->
                    </div>   
					<form class="form-horizontal" id="achat_form">
              <div class="block-content collapse in" id="div-1">     
                    	
                         <div class="control-group span6" style="margin-left: 0px;">
                            <label for="comment" class="control-label span4">Article</label>
                            <div class="controls">
                          		<select data-placeholder="Choose Article..." class="form-control chzn-select" name="ref_article" id="ref_article" tabindex="2">
              								  <option value="">-- Tous les Articles --</option>
              								   <?php
              									  $table = "SELECT DISTINCT (`ref_article`), `id_article`, `photo_name` FROM st_article ORDER BY id_article ASC;";     
              									  $colonne = mysql_query($table);     
              									  while($data = mysql_fetch_array($colonne)){
              										  echo '<option value="'.$data["id_article"].'" style=" margin:5px; background-repeat:no-repeat; background-size: 32px 32px;
              										  background-image:url('.$data["photo_name"].'); padding-left:4em;">'.$data["ref_article"].'</option>';
              									  }
              								  ?>
              							  </select>
                            </div>
                        </div> 

                        <div class="control-group span6" style="margin-left: 0px;">
                            <label for="comment" class="control-label span4">Tout Types</label>
                            <div class="controls">
                              <select data-placeholder="Types..." class="form-control chzn-select" name="id_type" id="id_type" tabindex="2">
                                <option value="">-- Tout Types --</option>
                                 <?php
                                  $table = "SELECT DISTINCT `id_type`, `nom_type` FROM st_att_type_article ORDER BY nom_type ASC;";     
                                  $colonne = mysql_query($table);     
                                  while($data = mysql_fetch_array($colonne)){
                                    echo '<option value="'.$data["id_type"].'" style=" margin:5px; background-repeat:no-repeat; background-size: 32px 32px;
                                    padding-left:4em;">'.$data["nom_type"].'</option>';
                                  }
                                ?>
                              </select>
                            </div>
                        </div> 

                        <div class="control-group span6" style="margin-left: 0px;">
                            <label for="comment" class="control-label span4">Emplacement</label>
                            <div class="controls">
                              <select data-placeholder="Unite de vente..." class="form-control chzn-select" name="id_lieu" id="id_lieu" tabindex="2">
                                <option value="">-- Emplacement --</option>
                                 <?php
                                  $table = "SELECT DISTINCT `id_lieu`, `nom_lieu` FROM st_att_lieu_article ORDER BY nom_lieu ASC;";     
                                  $colonne = mysql_query($table);     
                                  while($data = mysql_fetch_array($colonne)){
                                    echo '<option value="'.$data["id_lieu"].'" style=" margin:5px; background-repeat:no-repeat; background-size: 32px 32px;
                                    padding-left:4em;">'.$data["nom_lieu"].'</option>';
                                  }
                                ?>
                              </select>
                            </div>
                        </div> 

                       
                         <input type="button" style="float:right;width:200px;margin:20px;" value="Lancer recherche" class="btn btn-primary btn-sm" id="show" name="show">
                             <!-- /.control-group -->
                             <div class="span12" style="margin:0px;">
                             	
							 	                 <div id='statistique_mov'>
			   					               </div>
			   				              </div>
                    
                    </div>
              </div>
            <!--  ************************ / ROW ************************  -->
            
                
             </form>   
            </div>
          
          </div>
            <hr>
        </div>
<?php  include("template/footer_form.php") ; ?>
